package com.example.baseui2.netWork

import androidx.lifecycle.MutableLiveData
import com.example.baseui2.bean.TaxListBean
import com.google.gson.Gson
import com.missayawhr.taxcalcutor.api.ApiHelper
import com.whr.baseui.mvvm.BaseViewModel

class NetWorkViewModel : BaseViewModel() {
    var testData: MutableLiveData<String> = MutableLiveData()
    //一个简单的网络请求,launchRequest 网络请求包装,传入四个block参数,第一个为网络请求,第二个为成功返回,第三个为失败返回,第四个为请求结束finish()
    fun requestNewsData(type: String, page: Int, rows: Int) {
        showWaitDialog()
        launchRequest({
            ApiHelper.api()?.requestTaxNewsList("params")?.await()
        }, { t: String? ->
            testData.value = t
        }, { errMsg: String? ->
            showToast(errMsg)
            showStatusErrorView(errMsg)
        }, {
            hideWaitDialog()
        }
        )
    }
}